﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>云协作平台-密码找回</title>
    <!-- jquery.js -->
    <script th:src="@{/js/jquery-2.2.4.min.js}"></script>
    <script th:src="@{/js/workutil.js}"></script>
    <link rel="shortcut icon" th:href="@{/images/Logo_40.png}" type="image/x-icon">
    <!-- layui.css -->
    <link th:href="@{/plugin/layui/css/layui.css}" rel="stylesheet"/>
    <!-- 本页样式 -->
    <link th:href="@{/css/index.css}" rel="stylesheet"/>
</head>
<body>
<div class="mask"></div>
<div class="main">
    <h1><span style="font-size: 84px;">密码找回</span></h1>
    <p id="time"></p>
    <div class="enter">
        <from class="layui-form layui-form-pane" action="">
            <div class="layui-form-item">
                <input type="text" name="email" lay-verify="email"
                       placeholder="请输入邮箱" value="" autocomplete="off"
                       class="layui-input">
            </div>
            <div class="layui-form-item" style="text-align: center;">
                <button class="layui-btn" lay-submit="" lay-filter="findpass">发送</button>
            </div>
        </from>
    </div>
</div>
<!-- layui.js -->
<script th:src="@{/plugin/layui/layui.js}"></script>
<!-- layui规范化用法 -->
<script type="text/javascript">
    layui.define(['layer', 'form'], function (exports) {
        var form = layui.form;
        var $ = layui.jquery;

        //自定义验证
        form.verify({
            email: [/^[a-z0-9._%-]+@([a-z0-9-]+\.)+[a-z]{2,4}$|^1[3|4|5|7|8]\d{9}$/, '邮箱格式不对']
        })
        ;

        form.on('submit(findpass)', function (data) {
            var index = layer.load(1);
            workUtils.ajaxPost('../user/sendmail', data.field, function (result) {
                layer.close(index);
                workUtils.msg(result, function () {
                    if (result.status==true) {
                        location.href = "login";
                    }
                });
            });
            return false;
        });
    });

</script>
</body>
</html>